﻿using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Data;
/*************************************************************************************

     入库相关操作  liudan add
  
*************************************************************************************/
namespace BLL
{
    public class ICStockBLL
    {
        private ICStockDAL IcDal = new ICStockDAL();

        public DataSet GetICStockBill() 
        {
            return IcDal.GetICStockBill();
        }

        public DataSet GetICStockBillEntry(string FBrNo)
        {
            return IcDal.GetICStockBillEntry(FBrNo);
        }
        public DataSet GetICStockBillcount(string FBrNo)
        {
            return IcDal.GetICStockBillcount(FBrNo);
        }
        //获取仓位名称
        public bool GetPlaceName(string PlaceBarCode, out string PlaceName, out string FName)
        {
            return IcDal.GetPlaceName(PlaceBarCode, out PlaceName, out  FName);
        }
        
        //根据条码获取产成品入库的条码信息 ql 20181119
        public bool GetICStockBillEntryCode(string PkgsBarCode,string  FBrNo, out string FEntryNo, out string PlaceBarCode,out string PlaceName, out string dc)
        {
            return IcDal.GetICStockBillEntryCode(PkgsBarCode, FBrNo, out FEntryNo, out PlaceBarCode, out PlaceName, out dc);
                    }

        //更新入库单明细
        public bool UpdateICStockEntry(string FEntryNo, string PkgsBarCode, string PlaceBarCode, string dc)
        {
            return IcDal.UpdateICStockEntry(FEntryNo, PkgsBarCode, PlaceBarCode, dc);
        }
        /// <summary>
        /// 同步金蝶入库单
        /// </summary>
        /// <param name="FBillNo"></param>
        /// <returns></returns>
        public int INSERT_ICStockBill(string FBillNo)
        {
           return IcDal.INSERT_ICStockBill(FBillNo);
        }
        //完成入库单out
        public bool FinishICStock(string FBrNo, string ry,string id,out  string txt) 
        {
            bool lb_return = false;
            bool lb_finish = false;
            txt = "";
            lb_return = IcDal.IsFinishEnter(FBrNo, out txt);

            if (lb_return) 
            {
                //判断成功 可以入库
                lb_finish = IcDal.FinishEnterN(FBrNo, ry, id);
                if (!lb_finish) 
                {
                    lb_return = false;
                    txt = "完成入库单失败！";
                }

            }

            return lb_return;
        }

    }
}
